//
//  SearchPersonTableCell.m
//  MiaoTu
//
//  Created by dllo on 16/9/14.
//  Copyright © 2016年 dllo. All rights reserved.
//

#import "SearchPersonTableCell.h"
#import "UIImageView+WebCache.h"
#import "UserInfo.h"

@interface SearchPersonTableCell ()
@property (weak, nonatomic) IBOutlet UIImageView *headImage;
@property (weak, nonatomic) IBOutlet UILabel *nickNameLabel;
@property (weak, nonatomic) IBOutlet UILabel *maritalStatusLabel;
@property (weak, nonatomic) IBOutlet UIImageView *genderImage;
@property (weak, nonatomic) IBOutlet UILabel *ageLabel;

@end

@implementation SearchPersonTableCell

- (void)setUserInfo:(UserInfo *)userInfo {
    _userInfo = userInfo;
    
    [_headImage sd_setImageWithURL:[NSURL URLWithString:_userInfo.HeadUrl]];
    _nickNameLabel.text = _userInfo.Nickname;
    _maritalStatusLabel.text = _userInfo.MaritalStatus;
    if ([_userInfo.Gender isEqualToString:@"男"]) {
        _genderImage.image = [UIImage imageNamed:@"man"];
        _genderImage.backgroundColor = [UIColor colorWithRed:0.525 green:0.675 blue:0.929 alpha:1.000];
        _ageLabel.backgroundColor = [UIColor colorWithRed:0.525 green:0.675 blue:0.929 alpha:1.000];
    } else {
        _genderImage.image = [UIImage imageNamed:@"woman"];
        _genderImage.backgroundColor = [UIColor colorWithRed:0.929 green:0.494 blue:0.608 alpha:1.000];
        _ageLabel.backgroundColor = [UIColor colorWithRed:0.929 green:0.494 blue:0.608 alpha:1.000];
    }
    _ageLabel.text = @(_userInfo.Age).stringValue;
}

- (void)layoutSubviews {
    [super layoutSubviews];
    self.headImage.layer.cornerRadius = self.headImage.frame.size.width / 2;
    self.headImage.layer.masksToBounds = YES;
}

- (void)awakeFromNib {
    // Initialization code
    [super awakeFromNib];
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
